<template>
  <el-select v-model="name" placeholder="请选择角色" :multiple="props.multiple==1">
    <el-option v-for="item in options" :key="item._id" :label="item.name" :value="item._id" />
  </el-select>
</template>

<script setup lang="ts">
const { proxy } = getCurrentInstance();
let props = defineProps(["modelValue", "multiple"]);
const emit = defineEmits(["update:modelValue"]);
let options = ref([]);

onMounted(() => {
  getInfo();
});
const name = computed({
  get() {
    return props.modelValue;
  },
  set(value: Number) {
    emit("update:modelValue", value);
  },
});

let getInfo = async () => {
  options.value = await proxy.$apis.role({ type: "query" });
};
</script>

<style lang="scss" scoped>
</style>
